package com.java110.mall.chain.supplier.adaper.llk;

import java.nio.charset.Charset;
import java.util.Collections;

import com.alibaba.fastjson.JSONObject;
import org.springframework.http.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
@RequestMapping("/test")
public class TestController {
    @RequestMapping
    @ResponseBody
    public IndexInfo testMethod(IndexInfo indexInfo,@RequestBody String requestBody){
        System.out.println("indexinfo name -> "+indexInfo.getName()+" ;content -> "+indexInfo.getContent());
        System.out.println("request body -> "+requestBody);

        return indexInfo ;
    }

    public static void main(String[] args) {
        /*RestTemplate restTemplate = new RestTemplate() ;

        //创建要传递的对象
        HttpHeaders headers = new HttpHeaders();
       // headers.add("Content-Type","application/json;charset=utf-8");
        headers.setContentType(MediaType.parseMediaType("application/x-www-form-urlencoded;charset=UTF-8"));


        //设置相应内容，相应内容将被转换为json格式返回

        //设置HttpEntity的Body类型为String，调用StringHttpMessageConverter转换报文体参数
        JSONObject reqParam = new JSONObject();
        reqParam.put("channelId","4545");
        reqParam.put("sign","40ef4fe06308c0c4760af11e7afedbcd");
        reqParam.put("timestamp",System.currentTimeMillis());
        reqParam.put(  "encryptedData","q4Z76zt+Dbqoigdyl+hOFjLlevBW4zKhNwfF7qkvCNDwCgURn7KfXQKCnbdaDRfEGZH988UWcW+CJ2kTbmjGiUVNx5esiOeN4639RODfZAEqlVkvHFd0qOB4iyKeY2unSoW7GQtsIZ7agtIJwsL41OwOAQ8DD+ZhM8wIHhYVa+FDm+q3fldeCjt+f+79Xbgr9I3LOj3qg4+d9omwKcFQ0StWGGjtFCTx5oUGOlofrF3kFjzxvaH+tz/R5VTn8XzfkwBl7pYCSNwpeGnaHgZGpg55lxpliMpcKdWaDJoprIo=");
        HttpEntity httpEntity = new HttpEntity(reqParam.toJSONString(),headers);

        //发送post请求，并将返回的实体类型设置的IndexInfo
        ResponseEntity<String>   indexInfo = restTemplate.exchange("https://uapid.lianlianlvyou.com/ll/api/product/queryProductList", HttpMethod.POST, httpEntity, String.class) ;
*/

        String tt = "dddd";
        System.out.println(tt.split(","));



    }



}